import 'package:flutter_app/model/user_entity.dart';

userEntityFromJson(UserEntity data, Map<String, dynamic> json) {
	if (json['code'] != null) {
		data.code = json['code']?.toInt();
	}
	if (json['msg'] != null) {
		data.msg = json['msg']?.toString();
	}
	if (json['data'] != null) {
		data.data = new UserData().fromJson(json['data']);
	}
	return data;
}

Map<String, dynamic> userEntityToJson(UserEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['code'] = entity.code;
	data['msg'] = entity.msg;
	if (entity.data != null) {
		data['data'] = entity.data.toJson();
	}
	return data;
}

userDataFromJson(UserData data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['username'] != null) {
		data.username = json['username']?.toString();
	}
	if (json['token'] != null) {
		data.token = json['token']?.toString();
	}
	if (json['role'] != null) {
		data.role = json['role']?.toString();
	}
	if (json['platformList'] != null) {
		data.platformList = new List<UserDataPlatformList>();
		(json['platformList'] as List).forEach((v) {
			data.platformList.add(new UserDataPlatformList().fromJson(v));
		});
	}
	if (json['platformId'] != null) {
		data.platformId = json['platformId']?.toInt();
	}
	if (json['deptId'] != null) {
		data.deptId = json['deptId']?.toInt();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['uuid'] != null) {
		data.uuid = json['uuid']?.toString();
	}
	return data;
}

Map<String, dynamic> userDataToJson(UserData entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['username'] = entity.username;
	data['token'] = entity.token;
	data['role'] = entity.role;
	if (entity.platformList != null) {
		data['platformList'] =  entity.platformList.map((v) => v.toJson()).toList();
	}
	data['platformId'] = entity.platformId;
	data['deptId'] = entity.deptId;
	data['name'] = entity.name;
	data['uuid'] = entity.uuid;
	return data;
}

userDataPlatformListFromJson(UserDataPlatformList data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['name'] != null) {
		data.name = json['name']?.toString();
	}
	if (json['code'] != null) {
		data.code = json['code']?.toString();
	}
	if (json['projectName'] != null) {
		data.projectName = json['projectName']?.toString();
	}
	if (json['projectAddress'] != null) {
		data.projectAddress = json['projectAddress']?.toString();
	}
	if (json['projectImage'] != null) {
		data.projectImage = json['projectImage']?.toString();
	}
	if (json['projectFhddzl'] != null) {
		data.projectFhddzl = json['projectFhddzl']?.toString();
	}
	if (json['delFlag'] != null) {
		data.delFlag = json['delFlag'];
	}
	if (json['createTime'] != null) {
		data.createTime = new UserDataPlatformListCreateTime().fromJson(json['createTime']);
	}
	if (json['updateTime'] != null) {
		data.updateTime = new UserDataPlatformListUpdateTime().fromJson(json['updateTime']);
	}
	return data;
}

Map<String, dynamic> userDataPlatformListToJson(UserDataPlatformList entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['name'] = entity.name;
	data['code'] = entity.code;
	data['projectName'] = entity.projectName;
	data['projectAddress'] = entity.projectAddress;
	data['projectImage'] = entity.projectImage;
	data['projectFhddzl'] = entity.projectFhddzl;
	data['delFlag'] = entity.delFlag;
	if (entity.createTime != null) {
		data['createTime'] = entity.createTime.toJson();
	}
	if (entity.updateTime != null) {
		data['updateTime'] = entity.updateTime.toJson();
	}
	return data;
}

userDataPlatformListCreateTimeFromJson(UserDataPlatformListCreateTime data, Map<String, dynamic> json) {
	if (json['dayOfMonth'] != null) {
		data.dayOfMonth = json['dayOfMonth']?.toInt();
	}
	if (json['dayOfWeek'] != null) {
		data.dayOfWeek = json['dayOfWeek']?.toString();
	}
	if (json['month'] != null) {
		data.month = json['month']?.toString();
	}
	if (json['year'] != null) {
		data.year = json['year']?.toInt();
	}
	if (json['dayOfYear'] != null) {
		data.dayOfYear = json['dayOfYear']?.toInt();
	}
	if (json['hour'] != null) {
		data.hour = json['hour']?.toInt();
	}
	if (json['minute'] != null) {
		data.minute = json['minute']?.toInt();
	}
	if (json['nano'] != null) {
		data.nano = json['nano']?.toInt();
	}
	if (json['second'] != null) {
		data.second = json['second']?.toInt();
	}
	if (json['monthValue'] != null) {
		data.monthValue = json['monthValue']?.toInt();
	}
	if (json['chronology'] != null) {
		data.chronology = new UserDataPlatformListCreateTimeChronology().fromJson(json['chronology']);
	}
	return data;
}

Map<String, dynamic> userDataPlatformListCreateTimeToJson(UserDataPlatformListCreateTime entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['dayOfMonth'] = entity.dayOfMonth;
	data['dayOfWeek'] = entity.dayOfWeek;
	data['month'] = entity.month;
	data['year'] = entity.year;
	data['dayOfYear'] = entity.dayOfYear;
	data['hour'] = entity.hour;
	data['minute'] = entity.minute;
	data['nano'] = entity.nano;
	data['second'] = entity.second;
	data['monthValue'] = entity.monthValue;
	if (entity.chronology != null) {
		data['chronology'] = entity.chronology.toJson();
	}
	return data;
}

userDataPlatformListCreateTimeChronologyFromJson(UserDataPlatformListCreateTimeChronology data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toString();
	}
	if (json['calendarType'] != null) {
		data.calendarType = json['calendarType']?.toString();
	}
	return data;
}

Map<String, dynamic> userDataPlatformListCreateTimeChronologyToJson(UserDataPlatformListCreateTimeChronology entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['calendarType'] = entity.calendarType;
	return data;
}

userDataPlatformListUpdateTimeFromJson(UserDataPlatformListUpdateTime data, Map<String, dynamic> json) {
	if (json['dayOfMonth'] != null) {
		data.dayOfMonth = json['dayOfMonth']?.toInt();
	}
	if (json['dayOfWeek'] != null) {
		data.dayOfWeek = json['dayOfWeek']?.toString();
	}
	if (json['month'] != null) {
		data.month = json['month']?.toString();
	}
	if (json['year'] != null) {
		data.year = json['year']?.toInt();
	}
	if (json['dayOfYear'] != null) {
		data.dayOfYear = json['dayOfYear']?.toInt();
	}
	if (json['hour'] != null) {
		data.hour = json['hour']?.toInt();
	}
	if (json['minute'] != null) {
		data.minute = json['minute']?.toInt();
	}
	if (json['nano'] != null) {
		data.nano = json['nano']?.toInt();
	}
	if (json['second'] != null) {
		data.second = json['second']?.toInt();
	}
	if (json['monthValue'] != null) {
		data.monthValue = json['monthValue']?.toInt();
	}
	if (json['chronology'] != null) {
		data.chronology = new UserDataPlatformListUpdateTimeChronology().fromJson(json['chronology']);
	}
	return data;
}

Map<String, dynamic> userDataPlatformListUpdateTimeToJson(UserDataPlatformListUpdateTime entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['dayOfMonth'] = entity.dayOfMonth;
	data['dayOfWeek'] = entity.dayOfWeek;
	data['month'] = entity.month;
	data['year'] = entity.year;
	data['dayOfYear'] = entity.dayOfYear;
	data['hour'] = entity.hour;
	data['minute'] = entity.minute;
	data['nano'] = entity.nano;
	data['second'] = entity.second;
	data['monthValue'] = entity.monthValue;
	if (entity.chronology != null) {
		data['chronology'] = entity.chronology.toJson();
	}
	return data;
}

userDataPlatformListUpdateTimeChronologyFromJson(UserDataPlatformListUpdateTimeChronology data, Map<String, dynamic> json) {
	if (json['id'] != null) {
		data.id = json['id']?.toString();
	}
	if (json['calendarType'] != null) {
		data.calendarType = json['calendarType']?.toString();
	}
	return data;
}

Map<String, dynamic> userDataPlatformListUpdateTimeChronologyToJson(UserDataPlatformListUpdateTimeChronology entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['id'] = entity.id;
	data['calendarType'] = entity.calendarType;
	return data;
}